# 操作word
from docx import Document

# 1.打开Word
word = Document('测试.docx')
# 2. 获取段落
ps = word.paragraphs
print(ps)
# 3. 获取段落文本内容
for p in ps:
    print(p.text)
    # 4. 获取文字块文本内容
    for run in p.runs:
        print(run.text)

# 5. 遍历表格 按照行列都行
for t in word.tables:
    for row in t.rows:
        for cell in row.cells:
            print(cell.text)
